package be;

import java.util.Vector;
import util.JSONArray;
import util.JSONObject;

/**
 *
 * @author Dikas
 */
public class Sincronizacion {

    private Vector zonas;

    public Sincronizacion() {
        zonas = new Vector();
    }

    public Vector getZonas() {
        return zonas;
    }

    public void setZonas(Vector zonas) {
        this.zonas = zonas;
    }
    
    public void toObject(String json){
        try {
            JSONObject obj1 = new JSONObject(json);            
            JSONArray array = obj1.getJSONArray("zonas");
            for(int i=0; i<array.length(); i++){
                JSONObject obj2 = array.getJSONObject(i);                
                Zona zona = new Zona();
                zona.toObject(obj2.toString());
                zonas.addElement(zona);
            }            
        } catch (Exception e) {
            System.out.println("Error: " + e.getMessage());
            e.printStackTrace();
        }
    }
    
}
